-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional support for comments #61
base: master
Are you sure you want to change the base?
Conversation
7b73c53
to
9dc5d13
Compare
Hi, it would be great to add support for comments that do not break the JSON syntax. IE:
|
The problem with the It's also problematic to put a comment on the same line as data, or in the middle of a data structure when "adding extra comment data". As for syntax-highlighting that type of comment, it's probably possible, but what happens if a key "_comment" points to a value which is a larger data structure? Should that whole structure be highlighted as a comment? Maybe it only highlights the rest of that line as a comment? I might see if I can work up something useful that is turned on by setting a variable with the "comment" key to be used. Something like |
Hi @elzr , any possibility of this PR getting merged? I also find it quite useful, and being optional, it does not break 'normal' JSON behaviour. Thanks |
Hey @elzr , I agree that this seems perfectly reasonable. Even Douglas Crockford said that using json for configuration files and including comments is reasonable.
|
I'm also a fan of this pull request and hope it gets merged in some form. One suggestion: Support |
Since this PR doesn't seem to be going anywhere, I decided to package the changes as vim-jsonc using the |
How would one change all json files to be treated as jsonc? It would be great if this could just be merged in some way to make it easier to use. |
@ell1e I believe this should do the trick (if you didn't already find the solution): autocmd BufNewFile,BufRead *.json setl ft=jsonc |
👍 |
While not officially part of the JSON standard, there are many parsers which will accept comments.
This change allows users to set an option which recognizes comments as comments instead of an error.